<template>
  <div>
    <div class="guess-like-title">
      <span class="iconfont icon-like">&#xe612;</span>
      <span>猜你喜欢</span>
    </div>
    <ul>
      <li tag="li" class="item" v-for="item in likeImages" :key="item.id" @click="toDetail(item)">
        <div class="item-img-wrapper">
          <div class="item-img-top" v-if="item.buyUse == 1">
            <span class="top-font-style">随买随用</span>
          </div>
          <div
            class="item-img-top"
            v-if="item.buyUse == 0"
            style="background-image:url(https://img1.qunarzz.com/piao/fusion/1802/52/b9080e45b69b4f02.png)"
          >
            <span class="top-font-style">可定明日</span>
          </div>
          <img class="item-img" :src="item.bannerImg" />
        </div>
        <div class="item-img-right">
          <p class="item-title">{{item.sightName}}</p>
          <div class="item-comment">
            <span
              v-for="index in Number(item.score)"
              :key="index+5"
              class="iconfont icon-color"
            >&#xe6b0;</span>
            <span
              v-for="index in 5-Number(item.score)"
              :key="index"
              class="iconfont icon-color"
            >&#xe630;</span>

            <span class="icon-right-comment">{{item.comments}}条评论</span>
          </div>
          <div class="item-detail">
            <div>
              <span class="item-money-index" style="color:#FF7F50;">￥</span>
              <span class="item-money">{{item.money}}</span>
              <span class="item-money-index">起</span>
            </div>
            <p class="item-position">{{item.area}}</p>
          </div>
        </div>
      </li>
    </ul>
    <div class="all-product">查看所有产品</div>
  </div>
</template>

<script>
export default {
  name: 'HomeLike',
  props: {
    likeImages: Array
  },
  data() {
    return {}
  },
  methods: {
    toDetail(item) {
      this.$router.push({ path: '/detail', query: item })
    }
  }
}
</script>

<style scoped lang="stylus">
@import '~styles/mixins.styl';

.all-product {
  height: 0.8rem;
  line-height: 0.8rem;
  text-align: center;
  // background: red;
  color: #00afc7;
}

.guess-like-title {
  line-height: 0.8rem;
  text-indent: 0.2rem;
  font-size: 0.32rem;

  .icon-like {
    color: #FF4500;
  }
}

.item {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0.16rem 0.16rem;
  border-bottom: 0.01rem solid #e0e0e0;

  .item-img-wrapper {
    .item-img-top {
      background-image: url('https://img1.qunarzz.com/piao/fusion/1802/20/2ba6d10b17972e02.png');
      background-repeat: no-repeat;
      position: relative;
      height: 0.4rem;
      width: 1rem;
      border-bottom-right-radius: 50%;
      // ：0.05rem;
      margin-bottom: -0.36rem;
      line-height: 0.32rem;

      .top-font-style {
        font-size: 0.18rem;
        color: #fff;
        display: inline-block;
        height: 0.3rem;
        text-indent: 0.04rem;
      }
    }

    .img-top-tomorrow {
      background-image: url('https://img1.qunarzz.com/piao/fusion/1802/52/b9080e45b69b4f02.png');
      background-repeat: no-repeat;
      position: relative;
      height: 0.4rem;
      width: 1rem;
      border-bottom-right-radius: 50%;
      // ：0.05rem;
      margin-bottom: -0.36rem;
      line-height: 0.32rem;
    }

    .item-img {
      width: 2.2rem;
      height: 2.2rem;
      // margin-left: 0.06rem;
    }
  }

  .item-img-right {
    // margin-left: 0.1rem;
    // background: #ddd;
    width: 100%;
    padding: 0rem 0.2rem;

    .item-title {
      font-size: 0.32rem;
      display: inline-block;
      height: 0.62rem;
      line-height: 0.62rem;
      // background: red;
    }

    .item-comment {
      display: flex;
      height: 0.4rem;
      // background: green;
      align-items: center;

      // justify-content: center;
      .icon-right-comment {
        display: inline-block;
        margin-left: 0.2rem;
        color: #616161;
      }

      .icon-color {
        font-size: 0.24rem;
        color: #efb336;
        margin-right: 0.06rem;
      }
    }

    .item-detail {
      display: flex;
      align-items: center;
      height: 0.62rem;
      // background: red;
      justify-content: space-between;

      .item-position {
        min-width: 0;
        // background: red;
        text-align: right;
        width: 1.2rem;
        padding-right: 0.2rem;
        ellipsis();
      }

      .item-money {
        color: #FF7F50;
        display: inline-block;
        // background: blue;
        margin: 0rem;
        padding: 0rem;
        font-size: 0.36rem;
      }

      .item-money-index {
        color: #616161;
        font-size: 0.24rem;
      }
    }
  }
}
</style>
